import 'dart:ui';
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:flutter/material.dart';


class CustomConvexDelegate extends DelegateBuilder {
  final List<TabItem> items;
  final Color color;
  final Color activeColor;
  final double iconSize;
  final double fontSize;

  CustomConvexDelegate({
    required this.items,
    this.color = Colors.grey,
    this.activeColor = Colors.blue,
    this.iconSize = 24,
    this.fontSize = 12,
  });

  @override
  Widget build(BuildContext context, int index, bool active) {
    final item = items[index];
    final isActive = index == 2 ? false : active;

    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        SizedBox(
            width: index == 2 ? 40 : 16,
          // height: index == 2 ? 16 : 40,
            height: index == 2 ? 40 : 16,
            child: isActive? item.activeIcon : item.icon
        ),

        // Icon(
        //   item.icon,
        //   color: isActive ? activeColor : color,
        //   size: isActive ? iconSize + 4 : iconSize,
        // ),
        if (item.title != null)
          Padding(
            padding: const EdgeInsets.only(top: 4.0),
            child: Text(
              item.title!,
              style: TextStyle(
                color: isActive ? activeColor : color,
                fontSize: fontSize,
                fontWeight: isActive ? FontWeight.bold : FontWeight.normal,
              ),
            ),
          ),
      ],
    );
  }
  @override
  bool fixed() => true; // 如果需要固定样式返回true，动态样式返回false
}
